#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum Referent {
    /// One-off-ish address as used in Bitcoin and other UTXO-based chains.
    Ephemeral,

    /// Persistent account as used in Ethereum and other account-based chains.
    Account,

    /// Single-use payment data, potentially expiring, as used in Lightning.
    Invoice,
}

#[derive(Clone, Eq, PartialEq, Debug)]
pub enum AddressTy {
    /// Original Satoshi address, with 1-prefix
    BitcoinLegacy,

    /// Script hash, with 3-prefix address
    BitcoinP2SH,

    /// SegWit-style, with bc1-prefix
    BitcoinBech32,

    /// Lightning invoice, with lnbc1-prefix
    LightningInvoice,

    /// Simple Ethereum address, with 0x-prefix
    EthereumAddress,
}

impl AddressTy {
    pub fn referent(&self) -> Referent {
        use AddressTy::*;
        match self {
            BitcoinLegacy => Referent::Ephemeral,
            BitcoinP2SH => Referent::Ephemeral,
            BitcoinBech32 => Referent::Ephemeral,
            LightningInvoice => Referent::Invoice,
            EthereumAddress => Referent::Account,
        }
    }
}

#[derive(Clone, Eq, PartialEq, Debug)]
pub struct Address {
    text: String,
    ty: AddressTy,
}
